<?php

namespace Parser;

use Parser\Separator\BaseSeparator;
use ReflectionException;

/**
 * Class Parser
 * @package Parser
 */
class Parser
{
    public $rawData;

    public $code = '200';

    public $message;

    /**
     * @var BaseSeparator
     */
    public $separator;

    public $insureSource;

    public $predict;

    public $quoteNo;

    public $batch;

    public $orderId;

    public $engineNo;

    public $licenseNo;

    public $vin;

    public $companyId;

    public $batchId;
    /**
     * @var analysis
     */
    public $analysis;

    /**
     *
     * @var string
     */
    public $independentPriceRatio;

    /**
     * Author:ls
     *
     * @var string $type 报价类型
     * quote:单报价 batch:批量报价
     */
    public $type;

    public $result;


    //单次询价
    public function quote(array $predict): Quote
    {
        return new Quote($predict);
    }

    //单次询价
    public function batch(array $predict): Quote
    {
        return new Quote($predict,'batch');
    }


    //批量解析
    public function repetition(array $predict,$source): Repetition
    {
        $className = "Parser\\Separator\\" . $source;

        /**
         * @Var $source Separator\BaseSeparator
         */
        $separator = new $className;

        return $separator->repetition($predict);
    }
}

